package com.wz.boot.dao.weather;

import com.wz.boot.pojo.weather.WeatherLog;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.sql.Date;

@Repository
public interface WeatherLogDao {

    @Insert("insert into weatherlog(uid,area,date,week,weather,realt,lowest,highest,wind,winddeg,windspeed,windsc,sunrise,sunset,pcpn,uv_index,vis,humidity,tips,pop)values" +
            "(#{uid},#{area},#{date},#{week},#{weather},#{realt},#{lowest},#{highest},#{wind},#{winddeg},#{windspeed},#{windsc},#{sunrise},#{sunset},#{pcpn},#{uv_index},#{vis},#{humidity},#{tips},#{pop})")
    public Boolean addWeatherLog(@Param("uid") String uid,
                                 @Param("area")String area,
                                 @Param("date") Date date,
                                 @Param("week")String week,
                                 @Param("weather")String weather,
                                 @Param("realt")String realt,
                                 @Param("lowest")String lowest,
                                 @Param("highest")String highest,
                                 @Param("wind") String wind,
                                 @Param("winddeg")String winddeg,
                                 @Param("windspeed")String windspeed,
                                 @Param("windsc")String windsc,
                                 @Param("sunrise")String sunrise,
                                 @Param("sunset")String sunset,
                                 @Param("pcpn")String pcpn,
                                 @Param("uv_index")String uv_index,
                                 @Param("vis")String vis,
                                 @Param("humidity") String humidity,
                                 @Param("tips")String tips,
                                 @Param("pop")String pop);


    @Select("select * from weatherlog where area like '%${area}%' order by date desc limit 1")
    WeatherLog selectWeatherLogByPlaceName(@Param("area") String area);



}
